package com.liyuhan.onlinetaxibackground.Repository;

import com.liyuhan.onlinetaxibackground.POJO.CompletedOrder;
import com.liyuhan.onlinetaxibackground.POJO.Driver;
import com.liyuhan.onlinetaxibackground.POJO.Passenger;
import com.liyuhan.onlinetaxibackground.POJO.ReceivedOrder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface CompletedOrderRepository extends JpaRepository<CompletedOrder, Integer> {
    Optional<CompletedOrder> findCompletedOrderByReceivedOrder(ReceivedOrder order);

    Optional<List<CompletedOrder>> findCompletedOrdersByPassenger(Passenger passenger);

    Optional<List<CompletedOrder>> findCompletedOrdersByDriver(Driver driver);

    Optional<List<CompletedOrder>> findCompletedOrdersByPassengerAndState(Passenger passenger, String state);

    Optional<List<CompletedOrder>> findCompletedOrdersByDriverAndState(Driver driver, String state);
}
